<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
    <body>
	  <h:panelGrid columns="3"> 
		<h:outputLabel value="Ara: "/>
		<p:inputText value="#{SearchBean.text}">
		<p:ajax event="keyup" update="result"   
                    listener="#{SearchBean.search()}"/>  
		</p:inputText>
                <p:ajaxStatus rendered="#{HomePageBean.status==false}" style="width:16px;height:16px;" id="ajaxStatusPanel">  
                <f:facet name="start">  
                    <h:graphicImage value="img/ajaxloading.gif" />  
                </f:facet>  

                <f:facet name="complete">  
                    <h:outputText value="" />  
                </f:facet>  
                </p:ajaxStatus> 
		<p:commandButton value="Ara" action="#{SearchBean.search()}" ajax="false"/>
	  </h:panelGrid>
        <p:accordionPanel activeIndex="" multiple="true" id="result">
            <p:tab title="Öğrenciler (#{SearchBean.studentResultLenght} Sonuç bulundu)" id="student">
		<p:dataGrid var="student" value="#{SearchBean.studentResult}">
		    <p:column sortBy="#{student.firstName}">
			  <h:panelGrid columns="2">
				<h:graphicImage url="#{student.profilePicture}" width="70" height="70"/>
				<p:commandLink value="#{student.fullName}" actionListener="#{HomePageBean.clickStudent()}" ajax="false">
				    <f:setPropertyActionListener value="#{student}" target="#{StudentBean.target}"/>
				</p:commandLink>
			  </h:panelGrid>
		    </p:column>
		</p:dataGrid>
        </p:tab>
            <p:tab title="Öğretmenler (#{SearchBean.teacherResultLenght} Sonuç bulundu)" id="teacher">
		<p:dataGrid var="teacher" value="#{SearchBean.teacherResult}">
		    <p:column sortBy="#{teacher.firstName}">
			  <h:panelGrid columns="2">
				<h:graphicImage url="#{teacher.profilePicture}" width="70" height="70"/>
				<p:commandLink value="#{teacher.fullName}" actionListener="#{HomePageBean.clickTeacher()}" ajax="false">
				    <f:setPropertyActionListener value="#{teacher}" target="#{TeacherBean.target}"/>
				</p:commandLink>
			  </h:panelGrid>
		    </p:column>
		</p:dataGrid>
            </p:tab>
            <p:tab title="Gruplar (#{SearchBean.communityResultLenght} Sonuç bulundu)" id="community">
                    <p:dataGrid var="community" value="#{SearchBean.communityResult}">
                        <p:column sortBy="#{community.name}">
			  <h:panelGrid columns="2">
                              <p:commandLink value="#{community.name}" actionListener="#{HomePageBean.clickMyCommunitys()}" ajax="false">
				   <f:setPropertyActionListener value="#{community}" target="#{CommunityBean.target}"/>
				</p:commandLink>
			  </h:panelGrid>
		    </p:column>
		</p:dataGrid> 
            </p:tab>
        </p:accordionPanel>
    </body>
</html>
